package org.smartopen.unionpay.openapi.service.impl;

import lombok.Getter;
import org.smartframework.core.util.StrUtil;
import org.smartframework.unionpay.domain.request.SmartPayMicropayRequest;
import org.smartframework.unionpay.domain.request.SmartPayQueryRequest;
import org.smartframework.unionpay.domain.request.SmartPayRefundRequest;
import org.smartframework.unionpay.domain.request.SmartPayUnifiedorderRequest;
import org.smartframework.unionpay.domain.result.SmartPayMicropayResult;
import org.smartframework.unionpay.domain.result.SmartPayQueryResult;
import org.smartframework.unionpay.domain.result.SmartPayRefundResult;
import org.smartframework.unionpay.domain.result.SmartPayUnifiedorderResult;
import org.smartopen.unionpay.openapi.service.UnionPayOpenApiProfitSharingService;
import org.smartopen.unionpay.openapi.service.UnionPayService;
import org.smartopen.unionpay.openapi.service.feigin.RemoteUnionPayOpenApiService;


public class BaseUnionPayOpenApiServiceImpl implements UnionPayService {


    @Getter
    private final UnionPayOpenApiProfitSharingService profitSharingService;
    private final RemoteUnionPayOpenApiService openApiService;

    public BaseUnionPayOpenApiServiceImpl(RemoteUnionPayOpenApiService openApiService) {
        this.openApiService = openApiService;
        this.profitSharingService = new UnionPayOpenApiProfitSharingServiceImpl(openApiService);
    }

    @Override
    public SmartPayMicropayResult micropay(SmartPayMicropayRequest request) {
        return openApiService.micropay(request).serviceData();
    }

    @Override
    public SmartPayUnifiedorderResult unifiedorder(SmartPayUnifiedorderRequest request) {
        return openApiService.unifiedorder(request).serviceData();
    }

    @Override
    public SmartPayQueryResult queryOrder(SmartPayQueryRequest request) {
        return openApiService.queryOrder(request).serviceData();
    }

    @Override
    public SmartPayRefundResult refundOrder(SmartPayRefundRequest request) {
        return openApiService.refundOrder(request).serviceData();
    }
}
